﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MinToTray
{
    public partial class AuthForm : Form
    {
        public AuthForm()
        {
            InitializeComponent();
        }

      

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if(dxPwd.TextLength == 4 && dxPwd.Text == "2222")
            {
                this.DialogResult = DialogResult.OK;
            }
            if(dxPwd.TextLength == 4 && dxPwd.Text != "2222")
            {
                dxPwd.Text = null;
            }
        }

        private void AuthForm_Load(object sender, EventArgs e)
        {
            this.Activate();
            dxPwd.Focus();
        }

        private void AuthForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape) this.Close();
            if (e.Control && e.KeyCode == Keys.Z)
            {
                this.DialogResult = DialogResult.OK;
            }
        }

        private void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }
    }
}
